#!/usr/bin/evn python
# -*- coding: UTF-8 -*-
# @File: common_fun.py
# @Author: fy
# @date: 2021/10/31 10:09
import sys
import os

import yaml


def getProjectDir():
    '''
    获取工程路径，即weChatRequests的绝对路径
    :return:
    '''
    print(os.path.abspath(__file__))
    return os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
    # return sys.path[0]



def read_tokens_yaml() -> dict:
    file_name = os.sep.join([getProjectDir(), "datas", "tokens.yaml"])
    print(file_name)
    with open(file_name, encoding="utf-8") as f:
        datas = yaml.safe_load(f)
    return datas

if __name__ == "__main__":
    print(__name__)
    print(getProjectDir())
    print(read_tokens_yaml())
